<?php

class Annonces_model extends CI_Model {
	
	protected $table;

	function __construct(){
		parent::__construct();
		$this->table = 'annonces';
	}

	function get_annonces(){
		$res = $this->db->get($this->table);
		if($res->num_rows() != 0)
			return $res->result_array();
		else
			return array();
	}
	
	function insert($key , $post){
		$data = $post;
		$data['key'] = $key;
		$this->db->insert($this->table, $data);
	}

	function remove($key){
		$this->db->delete($this->table, array('key'=>$key));
	}

}
?>